<?php 
class Model_pdf extends CI_Model{
	function __construct(){
        parent::__construct();
	}
    function getItemList($id){
		$this->db->select("*");
		$this->db->from("invoice_item");
		$this->db->where("invo_id", $id);
		$query = $this->db->get();
		if($query->num_rows()>0){
			$hasil = $query->result_array();
			return $hasil;
		}
	}
	
	function getItemListLembur($id){
		$this->db->select("*");
		$this->db->from("lembur_item");
		$this->db->where("invo_id", $id);
		$query = $this->db->get();
		if($query->num_rows()>0){
			$hasil = $query->result_array();
			return $hasil;
		}
	}
    function getBillDetail($id){
		$this->db->select("*");
		$this->db->from("customerbill");
		$this->db->where("id", $id);
		$query = $this->db->get();
		if($query->num_rows()>0){
			$hasil = $query->result_array();
			return $hasil;
		}
	}
	function getDelivDetail($id){
		$this->db->select("*");
		$this->db->from("customerDelivery");
		$this->db->where("id", $id);
		$query = $this->db->get();
		if($query->num_rows()>0){
			$hasil = $query->result_array();
			return $hasil;
		}
	}
	function getPtDetail($id){
		$this->db->select("*");
		$this->db->from("pt");
		$this->db->where("pt_id", $id);
		$query = $this->db->get();
		if($query->num_rows()>0){
			$hasil = $query->result_array();
			return $hasil;
		}
	}
	function getInvoiceDetail($id){
		$this->db->select("*");
		$this->db->from("invoice");
		$this->db->where("invoice_no", $id);
		$query = $this->db->get();
		if($query->num_rows()>0){
			$hasil = $query->row_array();
			return $hasil;
		}
	}
	
	function getLemburDetail($id){
		$this->db->select("*");
		$this->db->from("lembur");
		$this->db->join('customer','customer.customer_id = lembur.cust_id','left');
		$this->db->join('driver','driver.driver_id= lembur.driver_id','left');
		$this->db->join('pt','pt.pt_id = lembur.pt_id','left');
		$this->db->where("lembur.invoice_id", $id);
		$query = $this->db->get();
		if($query->num_rows()>0){
			$hasil = $query->row_array();
			return $hasil;
		}
	}		
	function getDriverDetail($id){
		$this->db->select("*");
		$this->db->from("driver");
		//$this->db->join('driver','driver.drive_id = lembur.driver_id', 'left');
		$this->db->where("driver_id", $id);
		$query = $this->db->get();
		if($query->num_rows() > 0){
			$hasil = $query->row_array();
			return $hasil;
		}else{
			return array();
		}
	}
	function getNote($id){
		$this->db->select("*");
		$this->db->from("invoice");
		$this->db->where("invoice_no", $id);
		$query = $this->db->get();
		if($query->num_rows()>0){
			$hasil = $query->result_array();
			return $hasil;
		}
	}
}
?>